package com.bkhc.product.entity;

import com.bkhc.common.annotation.Uid;
import com.bkhc.common.enu.ProductStatusEnum;
import com.bkhc.common.listener.DataEntityListener;
import com.bkhc.common.service.RoleService;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 产品对象
 */
@Entity
@Data
@Table(name = "tbl_product_t")
@EntityListeners({AuditingEntityListener.class, DataEntityListener.class})
public class Product implements Serializable {


    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private int id ;

    @Column(name = "file_id")
    private String fileId;

    @Uid
    @Column(name = "product_code")
    private String productCode;

    @Column(name = "product_name")
    private String productName;

    @Column(name = "status")
    private ProductStatusEnum status;

    @Column(name = "unit")
    private String unit ;
    //产品属性
    @Transient
    private List<Spec> productSpecList;

    @Transient
    private List<ProductFile> productFileList;

    @Transient
    private List<ProductVideo> productVideoList;

//    //商品对象
//    @Transient
//    private List<Spec> SpecList;

    @Transient
    private List<Brand> brandList;

    @Column(name = "remarks",columnDefinition = "mediumtext")
    private String remarks;

    @Column(name = "content" ,columnDefinition = "text")
    private String content;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;

    @Column(name = "partner_id")
    private String partnerId;

    @Column(name = "product_type")
    private String productType;

    @Column(name = "sub_product_type")
    private String subProductType;

    @Column(name = "keywords")
    private String keywords;
}
